﻿using System.Threading;

namespace GameFramework.Extensions
{
    public static class CancellationTokenSourceExtensions
    {
        /// <summary>
        /// 取消任务并销毁实例
        /// </summary>
        public static void CancelAndDispose(this CancellationTokenSource cts)
        {
            cts.Cancel();
            cts.Dispose();
        }
    }
}